package com.cnswhy.cloud.server.core.oem;

import com.cnswhy.cloud.common.redis.service.RedisService;
import com.cnswhy.cloud.server.core.constant.RedisConstant;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class OemService {
    @Autowired
    RedisService redisService;

    public boolean isChaoRenGou(){
        try {
            String flag = (String) redisService.hget(RedisConstant.SYS_CONFIG_2,
                    RedisConstant.chao_ren_gou);
            if("true".equals(flag)){
                return true;
            }
        } catch (Exception e) {
            log.debug("未设置:chao_ren_gou");
            //e.printStackTrace();
        }
        return false;
    }
    public boolean isLeyoutuan(){
        try {
            String flag = (String) redisService.hget(RedisConstant.SYS_CONFIG_2,
                    RedisConstant.le_you_tuan);
            if("true".equals(flag)){
                return true;
            }
        } catch (Exception e) {
            log.debug("未设置:le_you_tuan");
        }
        return false;
    }
    public boolean isPintuanmao(){
        try {
            String flag = (String) redisService.hget(RedisConstant.SYS_CONFIG_2,
                    RedisConstant.pin_tuan_mao);
            if("true".equals(flag)){
                return true;
            }
        } catch (Exception e) {
            log.debug("未设置:pin_tuan_mao");
        }
        return false;
    }
    public boolean isLuyilu(){
        try {
            String flag = (String) redisService.hget(RedisConstant.SYS_CONFIG_2,
                    RedisConstant.lu_yi_lu);
            if("true".equals(flag)){
                return true;
            }
        } catch (Exception e) {
            log.debug("未设置:lu_yi_lu");
        }
        return false;
    }
    public String getOemInfo(){
        try {
            String oemInfo = (String) redisService.hget(RedisConstant.SYS_CONFIG_2,
                    RedisConstant.oem_info);
            return oemInfo;
        } catch (Exception e) {
            log.debug("未设置:chao_ren_gou");
            //e.printStackTrace();
        }
        return null;
    }
}
